﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XSTDZ.ERP.Core.Extentions;

namespace XSTDZ.ERP.Domain.Models
{
    /// <summary>
    /// 字典数据
    /// </summary>
    public partial class RefeType
    {
        public RefeType()
        {
          this.Refes=new HashSet<Refe>();
        }
        public RefeType AddRefe(Refe refe)
        {
            if(!this.Refes.Contains(refe))
            {
                this.Refes.Add(refe);
            }
            return this;
        }
        public RefeType AddRefes(IList<Refe> refes)
        {
            if(!refes.Equals(null))
            {
                refes.Each(refe=>AddRefe(refe));
            }
            return this;
        }
        public RefeType ClearRefes()
        {
            if (!this.Refes.Equals(null))
            {
                this.Refes.Clear();
            }
            return this;
        }
        public RefeType SetDeleteState(RefeType refeType)
        {
            if (!refeType.Equals(null) && !refeType.Equals(null))
            {
                refeType.Refes.Each(r => r.Deleted = 1);
            }
            return this;
        }
        public RefeType SetDeleteState(RefeType refeType,Guid refeId)
        {
            if (!refeType.Equals(null) && !refeType.Equals(null))
            {
                refeType.Refes.Where(r => r.Id == refeId).First().Deleted = 1;
            }
            return this;
        }
    }
}
